package com.caldremch.myhttp;


import com.google.gson.Gson;
import com.google.gson.JsonObject;


/**
 *
 * @author Caldremch
 * @date 2018/11/5
 * @Email caldremch@163.com
 * @describe 基础请求转换
 *
 **/
public class BaseReq {

    public BaseReq(Object data) {
        if (data instanceof JsonObject) {
            this.data = ((JsonObject) data).getAsString();
        } else if (data instanceof String) {
            this.data = (String) data;
        } else {
            this.data = new Gson().toJson(data);
        }
        this.currentTime = MyHttpUtils.getCurrentTime();
        this.checksum = MyHttpUtils.getCheckSum(this.data, this.currentTime);
    }

    public long currentTime;
    public String data;
    public String checksum;
}
